1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.StyleManager; 26 27 private import adw.c.functions; 28 public import adw.c.types; 29 private import gdk.Display; 30 private import gobject.ObjectG; 31 32 33 /** 34 * A class for managing application-wide styling. 35 * 36 * `AdwStyleManager` provides a way to query and influence the application 37 * styles, such as whether to use dark or high contrast appearance. 38 * 39 * It allows to set the color scheme via the 40 * [property@StyleManager:color-scheme] property, and to query the current 41 * appearance, as well as whether a system-wide color scheme preference exists. 42 * 43 * Since: 1.0 44 */ 45 public class StyleManager : ObjectG 46 { 47 /** the main Gtk struct */ 48 protected AdwStyleManager* adwStyleManager; 49 50 /** Get the main Gtk struct */ 51 public AdwStyleManager* getStyleManagerStruct(bool transferOwnership = false) 52 { 53 if (transferOwnership) 54 ownedRef = false; 55 return adwStyleManager; 56 } 57 58 /** the main Gtk struct as a void* */ 59 protected override void* getStruct() 60 { 61 return cast(void*)adwStyleManager; 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (AdwStyleManager* adwStyleManager, bool ownedRef = false) 68 { 69 this.adwStyleManager = adwStyleManager; 70 super(cast(GObject*)adwStyleManager, ownedRef); 71 } 72 73 74 /** */ 75 public static GType getType() 76 { 77 return adw_style_manager_get_type(); 78 } 79 80 /** 81 * Gets the default `AdwStyleManager` instance. 82 * 83 * It manages all [class@Gdk.Display] instances unless the style manager for 84 * that display has an override. 85 * 86 * See [func@StyleManager.get_for_display]. 87 * 88 * Returns: the default style manager 89 * 90 * Since: 1.0 91 */ 92 public static StyleManager getDefault() 93 { 94 auto __p = adw_style_manager_get_default(); 95 96 if(__p is null) 97 { 98 return null; 99 } 100 101 return ObjectG.getDObject!(StyleManager)(cast(AdwStyleManager*) __p); 102 } 103 104 /** 105 * Gets the `AdwStyleManager` instance managing @display. 106 * 107 * It can be used to override styles for that specific display instead of the 108 * whole application. 109 * 110 * Most applications should use [func@StyleManager.get_default] instead. 111 * 112 * Params: 113 * display = a `GdkDisplay` 114 * 115 * Returns: the style manager for @display 116 * 117 * Since: 1.0 118 */ 119 public static StyleManager getForDisplay(Display display) 120 { 121 auto __p = adw_style_manager_get_for_display((display is null) ? null : display.getDisplayStruct()); 122 123 if(__p is null) 124 { 125 return null; 126 } 127 128 return ObjectG.getDObject!(StyleManager)(cast(AdwStyleManager*) __p); 129 } 130 131 /** 132 * Gets the requested application color scheme. 133 * 134 * Returns: the color scheme 135 * 136 * Since: 1.0 137 */ 138 public AdwColorScheme getColorScheme() 139 { 140 return adw_style_manager_get_color_scheme(adwStyleManager); 141 } 142 143 /** 144 * Gets whether the application is using dark appearance. 145 * 146 * Returns: whether the application is using dark appearance 147 * 148 * Since: 1.0 149 */ 150 public bool getDark() 151 { 152 return adw_style_manager_get_dark(adwStyleManager) != 0; 153 } 154 155 /** 156 * Gets the display the style manager is associated with. 157 * 158 * The display will be `NULL` for the style manager returned by 159 * [func@StyleManager.get_default]. 160 * 161 * Returns: (nullable): the display 162 * 163 * Since: 1.0 164 */ 165 public Display getDisplay() 166 { 167 auto __p = adw_style_manager_get_display(adwStyleManager); 168 169 if(__p is null) 170 { 171 return null; 172 } 173 174 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p); 175 } 176 177 /** 178 * Gets whether the application is using high contrast appearance. 179 * 180 * Returns: whether the application is using high contrast appearance 181 * 182 * Since: 1.0 183 */ 184 public bool getHighContrast() 185 { 186 return adw_style_manager_get_high_contrast(adwStyleManager) != 0; 187 } 188 189 /** 190 * Gets whether the system supports color schemes. 191 * 192 * Returns: whether the system supports color schemes 193 * 194 * Since: 1.0 195 */ 196 public bool getSystemSupportsColorSchemes() 197 { 198 return adw_style_manager_get_system_supports_color_schemes(adwStyleManager) != 0; 199 } 200 201 /** 202 * Sets the requested application color scheme. 203 * 204 * The effective appearance will be decided based on the application color 205 * scheme and the system preferred color scheme. The 206 * [property@StyleManager:dark] property can be used to query the current 207 * effective appearance. 208 * 209 * Params: 210 * colorScheme = the color scheme 211 * 212 * Since: 1.0 213 */ 214 public void setColorScheme(AdwColorScheme colorScheme) 215 { 216 adw_style_manager_set_color_scheme(adwStyleManager, colorScheme); 217 } 218 }